package cn.hxth.cloud.api.mapper;


import cn.hxth.cloud.api.domain.ProductionOrder;
import cn.hxth.cloud.api.tk.mapper.MyMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ProductionOrderMapper extends MyMapper<ProductionOrder> {
    @Update("<script>" +
            "UPDATE  production_order SET status=#{status} WHERE id IN " +
            "<foreach collection='ids' item='id'  open='(' close=')' separator=','>"+
            " #{id}"+
            "</foreach>"+
            "</script>" )
    public  Boolean updateStatus(@Param("status") Integer status, @Param("ids")List<Integer> ids) ;
    @Select("SELECT count(*) FROM production_order WHERE oid = #{value} AND procedure_status&lt;2 ")
    public Long countByOrderInfoAndStatus(Long oid) ;
    @Select("SELECT DISTINCT production_order.id FROM steels,production_order  WHERE steels.id=production_order.sid AND steels_count<=inventory AND procedure_status=1")
    public  List<Long> findId() ;
}